package com.kaifamiao.jspcore;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.HttpJspPage;
import java.io.IOException;

// javax.servlet.jsp.HttpJspBase接口 继承了 javax.servlet.jsp.JspPage接口
// javax.servlet.jsp.JspPage接口 继承了 javax.servlet.Servlet接口
public abstract class KaifamiaoServlet extends HttpServlet implements HttpJspPage {

    public KaifamiaoServlet(){
        super();
        System.out.println( "KaifamiaoServlet" );
    }

    @Override
    public final void init(ServletConfig config)
            throws ServletException
    {
        super.init(config);
        jspInit();
    }

    @Override
    public final void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.log( "method: " + request.getMethod() );
        this.log( "request uri: " + request.getRequestURI() );
        this._jspService(request,response);
    }

    @Override
    public final void destroy() {
        jspDestroy();
    }

    @Override
    public void jspInit() {
    }

    @Override
    public void jspDestroy() {
    }

}
